const toLogin = function () {
	uni.login({
		provider: 'weixin',
		success: (wxres => {
			console.log("wxres",wxres)
			this.$api.request('/api/web/wxlogin','',{
				code: wxres.code
			}, failres => {
				uni.showToast({
					title: failres.msg,
					icon: "none"
				});
			}).then(res => {
				uni.setStorageSync('token', res.data.token);
				uni.setStorageSync('openid', res1.data.openid);
				uni.setStorageSync('userId', res.data.user.userId);
			})
		})
	})
}

export const util = {
	toLogin
}